Skip to content

Conversation

mrtzgh
Copy link

@mrtzgh mrtzgh commented Jul 4, 2025

Add Configurable Log Formatting Options for Supervisor

Fixes #553 - This PR implements highly requested log formatting configuration options for Supervisor, addressing community feedback.

What's New

Two new configuration options:

  • logfile_format - Customizes main supervisord log messages
  • childlog_format - Customizes child process log messages (stdout/stderr)

Both support Python logging format strings with placeholders like %(asctime)s, %(levelname)s, %(process)d, etc.

Example Usage

[supervisord]
logfile_format=%(asctime)s [%(levelname)s] [PID:%(process)d] %(message)s
childlog_format=%(asctime)s [CHILD] %(message)s

Output:

# Main log
2024-01-15 10:30:15,123 [INFO] [PID:1234] supervisord started with pid 1234

# Child logs
2024-01-15 10:30:16,456 [CHILD] Starting application server

Key Features

backward compatible - existing configs work unchanged
error handling - invalid formats fall back to defaults
tests - all existing tests pass + new coverage
documentation - examples, best practices, troubleshooting

Benefits

  • Enhanced debugging with timestamps and PIDs
  • Better integration with log aggregation systems (ELK, Splunk, etc.)
  • Support for compliance logging requirements
  • Customizable formats for specific operational needs

This addresses a long-standing community request for better control over Supervisor's logging output while maintaining full compatibility.

@mrtzgh mrtzgh force-pushed the feature/custom-log-formatting branch from 444623f to 0b30bb3 Compare July 4, 2025 09:29
@mrtzgh mrtzgh marked this pull request as draft July 4, 2025 09:29
@mrtzgh mrtzgh marked this pull request as ready for review July 4, 2025 09:30
@mrtzgh mrtzgh force-pushed the feature/custom-log-formatting branch 2 times, most recently from 457df6c to d69082e Compare July 11, 2025 15:15
@mrtzgh mrtzgh force-pushed the feature/custom-log-formatting branch from d69082e to 01e4121 Compare July 14, 2025 10:23
@coredumperror
Copy link

This is excellent! Hope it gets merged soon. That "failing" test doesn't seem to be related to this PR, but rather an issue with the CI system itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to specify log format
2 participants